<%@ page language="java" contentType="application/vnd.ms-excel; name='member'; charset=UTF-8" pageEncoding="UTF-8"  import="java.util.*,common.*,java.sql.*,db.*"%>
<%
response.setHeader("Content-Disposition", "inline; filename=rater.xls"); // 파일 이름 지정
response.setHeader("Content-Description", "JSP Generated Data");
%>    
<%
		request.setCharacterEncoding("utf-8");
		
UserSession userSession = (UserSession)session.getAttribute("user"); 

String login_id = null;
String user_id = null;
String level = null;

if(userSession!= null){
	login_id = userSession.getLogin_id();
	user_id = userSession.getUser_id();
	level = userSession.getAdmin_level();
}

String gubun	= CommonUtil.nvl(request.getParameter("gubun"),"OPIC"); 
String start_date	= CommonUtil.nvl(request.getParameter("start_date"),""); 
String end_date	= CommonUtil.nvl(request.getParameter("end_date"),"");

if(gubun.equals("")){
	gubun = "OPIC";
}

HashMap listMap=(HashMap)request.getAttribute("list_map");

HashMap map  = null;
ArrayList list=null;

HashMap map_1  = null;
ArrayList list_1=null;

String rater_id 	= "";
String rater_name 	= "";
String per_cnt	= "0";


String rater_cnt = "0";
String ready = "0";
String progress = "0";
String end = "0";
String holding = "0";

String s_total_cnt	= "0";

String v_start_date	= ""; 
String v_end_date	= "";

if (listMap!=null){
    list=(ArrayList)listMap.get("mainContent");
}

if(list != null){
	if(list.size() > 0){
		s_total_cnt = CommonUtil.nvl((String)((HashMap)list.get(0)).get("s_total_cnt"),"0");
		v_start_date = CommonUtil.nvl((String)((HashMap)list.get(0)).get("v_start_date"),"");
		v_end_date = CommonUtil.nvl((String)((HashMap)list.get(0)).get("v_end_date"),"");
	}
}

if(v_start_date.equals("")){
	v_start_date = CommonUtil.getToday("yyyy")+"-"+CommonUtil.getToday("MM")+"-"+CommonUtil.getToday("dd");
	v_end_date = CommonUtil.getToday("yyyy")+"-"+CommonUtil.getToday("MM")+"-"+CommonUtil.getToday("dd");
}

if(start_date.equals("")){
	start_date = v_start_date;
}

if(end_date.equals("")){
	end_date = v_end_date;
}

String[] start_date_arr = start_date.split("-");
String[] end_date_arr = end_date.split("-");	
	
        
		
		
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Excel Download</title>
</head>
<body>
<form name="excel_frm">
<b></b>
</BR>
</BR>
<B>전체 시험완료 횟수 : <%=s_total_cnt %></B> 
<table width="760" border="1" cellpadding="2" cellspacing="0" bordercolor="C0C0C0" bordercolordark="#FFFFFF" frame=below >
	<tr height="23">
		<td width="50" bgcolor="#D3EBD7" align="center"> 번호 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> Rater </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 비율 </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> 할당횟수 </td>
	    <td width="160" bgcolor="#D3EBD7" align="center"> Ready </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> Progress </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> End </td>
		<td width="160" bgcolor="#D3EBD7" align="center"> Holding </td>
	</tr>
	<%               

    if (list!=null && list.size()> 0) {
    	for(int i=0; i<list.size(); i++){
	      map=(HashMap)list.get(i);
	      rater_id = CommonUtil.nvl((String)map.get("rater_id"));
	      rater_name = CommonUtil.nvl((String)map.get("rater_name"));
	      per_cnt = CommonUtil.nvl((String)map.get("per_cnt"));
	      rater_cnt = CommonUtil.nvl((String)map.get("rater_cnt"));
	      ready = CommonUtil.nvl((String)map.get("ready"));
	      progress = CommonUtil.nvl((String)map.get("progress"));
	      end = CommonUtil.nvl((String)map.get("end"));
	      holding = CommonUtil.nvl((String)map.get("holding"));
%>
			  <tr>
			  	<td><%=i+1%></td>
                <td><%=rater_name %></td>
                <td ><%=per_cnt%>%</td>
                <td><%=rater_cnt %></td>
                <td><%=ready %></td>
                <td><%=progress %></td>
                <td><%=end %></td>
                <td><%=holding %></td>
              </tr>
<%	      
    	}
    }else{
%>
              <tr>
                <td colspan=8 align=center>할당 된  자료가 없습니다.</td>
              </tr>
<%} %>  
</table>
</form>
</body>
</html>
